package com.zndroid.logcat;

import android.app.Application;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.zndroid.logcat.displayer.FloatingLifecycle;

/**
 * Created by lzy on 2021/1/20.
 * <br>自动开启(全局),通过手动进行关闭
 * <br>您需要在清单文件中注册如下（直接复制即可）：
 * <code>
 *     <application>
 *         ...
 *         <provider
 *             android:authorities="${applicationId}.logcat.provider"
 *             android:name="com.zndroid.logcat.LogcatProvider"
 *             android:exported="false"/>
 *             ...
 *     </application>
 * </code>
 *
 */
public class LogcatProvider extends ContentProvider {
    @Override
    public boolean onCreate() {
        if (getContext() != null) {
            if (getContext() instanceof Application) {
                FloatingLifecycle.with((Application) getContext());
            }
        }
        return true;
    }

    @Nullable
    @Override
    public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
        return null;
    }

    @Nullable
    @Override
    public String getType(@NonNull Uri uri) {
        return null;
    }

    @Nullable
    @Override
    public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
        return null;
    }

    @Override
    public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }

    @Override
    public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
        return 0;
    }
}
